<!DOCTYPE html>
<html lang="en">
<head>
    <title>库存管理</title>
</head>
<body>
<div class="page-container">
    <div class="page-content">
        <div class="container">
            <div class="page-bar" style="background-color: #fff;margin-bottom: 5px;margin-top: 10px;">
                <ul class="page-breadcrumb">
                    <li>
                        <i class="glyphicon glyphicon-cog"></i>
                        <span>库存信息管理</span>
                    </li>
                </ul>
                <div class="page-toolbar">
                    <div class="btn-group pull-right">
                        <ul class="page-breadcrumb">
                            <li>
                                <a href="${rootPath}/productManage/toPage/stockManageView">
                                    <span class="font-black-sharp">库存管理</span></a>
                            </li>
                            <li>
                                |<a href="${rootPath}/productManage/toPage/stockChangeHisView">
                                <span class="font-black-sharp  activity">库存变动历史</span></a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <div class="portlet light bordered">
                        <div class="portlet-title">
                            <div class="caption">
                              <span class="caption-subject font-green-sharp bold uppercase">
                              <i class="fa fa-gift"></i> 搜索条件
                              </span>
                            </div>
                        </div>
                        <div class="portlet-body form">
                            <form action="javascript:;" id="searchForm" class="form-horizontal">
                                <div class="form-body">
                                    <div class="col-lg-4 col-md-6 col-sm-6 col-xs-12">
                                        <div class="form-group">
                                            <label class="col-md-4 control-label">产品编号：</label>
                                            <div class="col-md-8">
                                                <input class="form-control" type="text" id="productId" name="productId">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-lg-4 col-md-6 col-sm-6 col-xs-12">
                                        <div class="form-group">
                                            <label class="col-md-4 control-label">产品名称：</label>
                                            <div class="col-md-8">
                                                <input class="form-control" type="text" id="productName" name="productName">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-lg-4 col-md-6 col-sm-6 col-xs-12">
                                        <div class="form-group">
                                            <label class="col-md-4 control-label">变动类型：</label>
                                            <div class="col-md-8">
                                                <select class="hasReward form-control" name="recordType"
                                                        id="recordType" >
                                                    <option value="">请选择</option>
                                                    <option value="1">售出</option>
                                                    <option value="2">生产增加</option>
                                                    <option value="3">订单取消退回</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-lg-4 col-md-6 col-sm-6 col-xs-12">
                                        <div class="form-group">
                                            <label class="col-md-4 control-label">变动人员：</label>
                                            <div class="col-md-8">
                                                <input class="form-control" type="text" id="operateId" name="operateId">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-lg-4 col-md-6 col-sm-6 col-xs-12">
                                        <div class="form-group">
                                            <label class="col-md-4 control-label">开始时间：</label>
                                            <div class="col-md-8">
                                                <input class="form-control" placeholder="请选择最早启动时间" type="text"
                                                       id="startTime" name="startTime"
                                                       onClick="WdatePicker({dateFmt: 'yyyy-MM-dd'});">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-lg-4 col-md-6 col-sm-6 col-xs-12">
                                        <div class="form-group">
                                            <label class="col-md-4 control-label">结束时间：</label>
                                            <div class="col-md-8">
                                                <input class="form-control" placeholder="请选择最迟结束时间" type="text"
                                                       id="endTime" name="endTime"
                                                       onClick="WdatePicker({dateFmt: 'yyyy-MM-dd'});">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="text-right">
                                        <button type="button" class="btn green" onclick="selectStockChangeList()">查询
                                        </button>
                                        <button type="button" id="resetBtn" class="btn">重置
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <div class="portlet light bordered">
                        <div class="portlet-title">
                            <div class="caption">
                              <span class="caption-subject font-green-sharp bold uppercase">
                              <i class="fa fa-gift"></i> 库存变动历史列表
                              </span>
                            </div>
                        </div>
                        <div class="portlet-body">
                            <table id="stockChangeTable"
                                   class="table table-striped table-bordered table-hover"
                                   data-toggle="table"
                                   data-method="post"
                                   data-content-type="application/x-www-form-urlencoded"
                                   data-query-params="queryParams"
                                   data-pagination="true"
                                   data-click-to-select="true"
                                   data-side-pagination="server"
                                   data-sort-name="operate_date"
                                   data-sort-order="desc"
                                   data-page-number="1"<#--第几页-->
                                   data-page-size="5"<#--每页数据条数-->
                                   data-page-list="[10, 20, 50, 200]"
                                   data-search-align = "left"
                            >
                                <thead>
                                <tr>
                                    <th data-radio="true" checkbox="true" ></th>
                                    <th data-field="product_id">产品编号</th>
                                    <th data-field="product_name">产品名称</th>
                                    <th data-field="author">作者</th>
                                    <th data-field="press" >出版社</th>
                                    <th data-field="type_name">类别</th>
                                    <th data-field="stock_change" >变动库存量</th>
                                    <th data-field="record_type_name" >变动类型</th>
                                    <th data-field="operate_id" >变动员工</th>
                                    <th data-field="operate_date" data-formatter="dateTimeFormatter">变动时间</th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    jQuery(document).ready(function () {
        selectStockChangeList();
        $("#resetBtn").on("click",function () {
            $("#productName").val("");
            $("#productId").val("");
            $("#recordType").val("");
            $("#operateId").val("");
            $("#startTime").val("");
            $("#endTime").val("");
        });
    });
    function queryParams(params) {
        return getQueryParams(params, "searchForm");
    }
    function selectStockChangeList() {
        $('#stockChangeTable').bootstrapTable("destroy");
        $('#stockChangeTable').bootstrapTable({
            method: "post",
            url: rootPath+"/productManage/ajax/getStockChangeList",
            showExport : true,
            exportTypes: ['excel'],//['json', 'xml', 'csv', 'txt', 'sql', 'excel'],
            Icons:'glyphicon-export',
            exportOptions:{
                ignoreColumn: [0],  //忽略某一列的索引
                fileName: '库存变动历史列表',  //文件名称设置
                worksheetName: 'sheet1',  //表格工作区名称
                tableName: '库存变动历史列表'
            },
            exportDataType : 'all'
        });
    }
</script>
</body>
</html>